﻿@model Pre.CRM.Models.CustomersModel
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<label class="lb_namecompany"></label>
    <a name="" type="button" value="" class="bt_black" width="26"  height="26" href='javascript:history.back();'></a>
<div class="space"></div>
<form id='frmColor' method="POST">
    
    <ul class="ul_find_color">
        @foreach (var status in Model.WebStatus)
        {
            var color = status.Id == 1 ? "#663399" : status.Id == 2 ? "#9966cc" : status.Id == 3 ? "#ffcc00" : status.Id == 4 ? "#006699" : status.Id == 5 ? "#3399cc" : "#FF0000";
            var check = Model.Status.Contains(status.Id) ? "checked='checked'" : "";
            
            <li class="li_find_color">
                <div class="frame_check_color" style="background:@color">
                    <center><input name="status" type="checkbox" value="@status.Id" @check onclick="Fillter()"/></center>
                </div>
                <center><label class="check_color_name">@status.Name</label></center>
            </li>
        }
        <div class="space"></div>
    </ul>
    <input type="hidden" name="agent" value="@Model.Agent"/>
</form>
	
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    @foreach (var o in Model.Customers)
    {
        var color = o.StatusId == 1 ? "#663399" : o.StatusId == 2 ? "#9966cc" : o.StatusId == 3 ? "#ffcc00" : o.StatusId == 4 ? "#006699" : o.StatusId == 5 ? "#3399cc" : "#FF0000";
        var domain = o.Id.Length > 17 ? o.Id.Substring(0, 17) + "..." : o.Id;
        <tr>
            <td class="border_bottom"><div class="color_content" style='background:@color'></div></td>
            <td class="padding_left_10px padding_bottom_10px padding_top_10px border_bottom" style='overflow:hidden;width:170px'><a href="/Customer/Detail?agent=@Model.Agent&customer=@o.Id" class="a_link">@domain</a></td>
            <td width="36"  height="36" class="padding_left_10px padding_right_10px border_bottom">
                <a href="/Customer/Contact?customer=@o.Id"><img src="/Content/images/bt_contact.jpg" alt="detail" width="36px" height="36px"/></a>    </td>
            <td width="36" height="36"  class="padding_right_10px border_bottom">
                <a href="/Customer/CreateKey?agent=@Model.Agent&customer=@o.Id"><img src="/Content/images/cre_key.jpg" alt="detail" width="36px" height="36px"/></a>
            </td>
            <td width="36" height="36" class="border_bottom">
                <a href="/Customer/Contract?agent=@Model.Agent&customer=@o.Id"><img src="/Content/images/contract.jpg" alt="detail" width="36px" height="36px"/></a>
            </td>
        </tr>
    }
</table>

<script language="javascript">
    function Fillter() {
        $("#frmColor").submit();
    }
</script>

